#ifndef _MOVEMENT_HANDLER
#define _MOVEMENT_HANDLER

enum MoveFlags
{
    MOVEFLAG_MOVE_STOP                  = 0x00,
	MOVEFLAG_MOVE_FORWARD				= 0x01,
	MOVEFLAG_MOVE_BACKWARD				= 0x02,
	MOVEFLAG_STRAFE_LEFT				= 0x04,
	MOVEFLAG_STRAFE_RIGHT				= 0x08,
	MOVEFLAG_TURN_LEFT					= 0x10,
	MOVEFLAG_TURN_RIGHT					= 0x20,
	MOVEFLAG_PITCH_DOWN					= 0x40,
	MOVEFLAG_PITCH_UP					= 0x80,

	MOVEFLAG_WALK						= 0x100,
	MOVEFLAG_TAXI						= 0x200,		
	MOVEFLAG_NO_COLLISION				= 0x400,
	MOVEFLAG_FLYING	    				= 0x800,
	MOVEFLAG_JUMPING					= 0x1000,
	MOVEFLAG_FALLING					= 0x2000,
	MOVEFLAG_FALLING_FAR				= 0x4000,
	MOVEFLAG_FREE_FALLING				= 0x8000,

	MOVEFLAG_TB_PENDING_STOP			= 0x10000,
	MOVEFLAG_TB_PENDING_UNSTRAFE		= 0x20000,
	MOVEFLAG_TB_PENDING_FALL			= 0x40000,
	MOVEFLAG_TB_PENDING_FORWARD			= 0x80000,
	MOVEFLAG_TB_PENDING_BACKWARD		= 0x100000,
	MOVEFLAG_SWIMMING          		    = 0x200000,
	MOVEFLAG_FLYING_PITCH_UP	        = 0x400000,
	MOVEFLAG_CAN_FLY					= 0x800000,

	MOVEFLAG_AIR_SUSPENSION	   	 		= 0x1000000,
	MOVEFLAG_AIR_SWIMMING				= 0x2000000,
	MOVEFLAG_SPLINE_MOVER				= 0x4000000,
	MOVEFLAG_IMMOBILIZED				= 0x8000000,
	MOVEFLAG_WATER_WALK					= 0x10000000,
	MOVEFLAG_FEATHER_FALL				= 0x20000000,
	MOVEFLAG_LEVITATE					= 0x40000000,
	MOVEFLAG_LOCAL						= 0x80000000,

	MOVEFLAG_MOVING_MASK				= 0x03,
	MOVEFLAG_STRAFING_MASK				= 0x0C,
	MOVEFLAG_TURNING_MASK				= 0x30,
	MOVEFLAG_FALLING_MASK				= 0x6000,
	MOVEFLAG_MOTION_MASK				= 0xE00F,
	MOVEFLAG_PENDING_MASK				= 0x7F0000,
	MOVEFLAG_PENDING_STRAFE_MASK		= 0x600000,
	MOVEFLAG_PENDING_MOVE_MASK			= 0x180000,
	MOVEFLAG_FULL_FALLING_MASK			= 0xE000,
};

class MovementHandler
{
public:
	Player* m_player;
	ui32 lastflags, time, falltime, unklast, splineunk;
	ui16 _230, unk_320;
	float x, y, z, o;
	ui64 transporter;
	float Tx, Ty, Tz, To, Tu;
	ui8 Tu2;
	float pitch;
	ui32 unk1, unk2, unk3, unk4;
	bool jumped, fallen, swimming, flying, taxi;
	float last_z;
	MovementHandler(Player* plr)
	{
		m_player = plr;
		last_z = 0.0f;
	}
	void PullMovementInfo(RealmPacket* pack);
	void Reset()
	{
		lastflags = time = falltime = unk1 = unk2 = unk3 = unk4  = Tu2 = 0;
		transporter = 0;
		_230 = 0;
		x = y = z = o = Tx = Ty = Tz = To = Tu = pitch = 0.0f;
		jumped = fallen = swimming = flying = taxi = false;
	}
};

#endif